﻿@page
@{ Layout = "_Layout"; }
@section Styles{
  <style>
    .commands div { display: inline-block; width: auto; }
    .el-upload, .el-upload-dragger { display: inline-block; width: auto; }
    .el-icon-arrow-down {
      font-size: 12px;
    }
    .el-icon-picture-outline {
      font-size: 22px;
      margin: 80px 0;
      color: #c0c4cc;
    }
    .el-card-wrapper {
      padding-bottom: 15px; 
      padding-right: 15px; 
      width: 25%; 
      box-sizing: border-box;
      display: inline-block;
      vertical-align: top;
    }

    .thumb {
      padding: 10px;
    }
    .thumb .cover {
      cursor: pointer; 
      position: relative; 
      height:150px; 
      background-size: cover;
      background-position: 50% 50%;
      background-repeat: no-repeat;
      background-color: #f6f8f9;
    }
    .thumb .cover .text {
      position: absolute;
      bottom: 0;
      text-align: center;
      display: block;
      width: 100%;
      color: #fff;
      padding: 6px;
      background-color: rgba(202, 195, 195, 0.28);;
    }
    .list {
      padding: 10px;
      cursor: pointer;
    }
    .thumb:hover, .active, .list:hover {
      background: rgb(225, 243, 216);
    }
    .list .text {
      text-align: left;
      font-size: 14px;
      height: 38px;
      overflow: hidden;
    }
  </style>
}

<el-row>
  <el-col :span="12">
    <el-form v-on:submit.native.prevent :inline="true" :model="form" size="mini">
      <el-form-item label="搜索">
        <el-input v-model="form.keyword" placeholder="关键字"></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" v-on:click="btnSearchClick">查询</el-button>
      </el-form-item>
    </el-form>
  </el-col>
  <el-col class="commands" align="right" :span="12">
    <el-radio-group v-model="showType" plain size="small">
      <el-radio-button label="card">卡片视图</el-radio-button>
      <el-radio-button label="list">列表视图</el-radio-button>
    </el-radio-group>
  </el-col>
</el-row>

<el-form v-on:submit.native.prevent :inline="true" :model="form">
  <el-form-item label="分组">

    <el-tag
      v-for="group in groups"
      :key="group.id"
      type="success"
      style="cursor: pointer; margin: 0 3px 6px 0;"
      v-on:click="btnGroupClick(group.id)"
      :effect="form.groupId === group.id ? 'dark' : 'plain'">
      {{ group.groupName }}
    </el-tag>
   
  </el-form-item>
</el-form>

<template v-if="showType === 'card'">
  <el-row>
    <el-col :span="6" v-for="(image, index) in images" :key="image.id">
      <el-card size="small" style="margin-bottom: 15px; margin-right: 15px; height: 305px" :body-style="{ padding: '0px', textAlign: 'center' }">
        <el-link :underline="false" v-on:click="btnImageClick(image)">
          <el-image 
            style="width: 100%; min-height: 220px; max-height:220px;"
            :src="image.url">
            <div slot="error" class="image-slot">
              <i class="el-icon-picture-outline"></i>
            </div>
          </el-image>
        </el-link>

        <div style="padding: 14px;">
          <div v-on:click="btnImageClick(image)" style="cursor: pointer; height: 22px; font-size: 14px; overflow: hidden;">{{ image.title }}</div>
        </div>
      </el-card>
    </el-col>
  </el-row>
</template>
<template v-else>
  <el-table
    :data="images"
    style="width: 100%">
    <el-table-column
      label="图片"
      width="150">
      <template slot-scope="scope">
        <el-link :underline="false" v-on:click="btnImageClick(scope.row)">
          <el-image 
            style="max-height: 120px; max-width: 120px;"
            :src="scope.row.url">
            <div slot="error" class="image-slot">
              <i class="el-icon-picture-outline"></i>
            </div>
          </el-image>
        </el-link>
      </template>
    </el-table-column>
    <el-table-column label="标题">
      <template slot-scope="scope">
        <el-link :underline="false" v-on:click="btnImageClick(scope.row)" style="cursor: pointer; height: 22px; overflow: hidden; font-size: 14px;" type="primary">{{ scope.row.title }}</el-link>
      </template>
    </el-table-column>
    <el-table-column
      prop="createdDate"
      label="创建时间"
      width="220">
    </el-table-column>
  </el-table>
</template>

<el-divider></el-divider>
<el-row style="margin: 10px;">
  <el-col :span="20" align="left">
    <div style="text-align: left;">
      <el-pagination
        v-on:current-change="btnPageClick"
        :current-page="form.page"
        :page-size="form.perPage"
        layout="total, prev, pager, next, jumper"
        :total="count">
      </el-pagination>
    </div>
  </el-col>
  <el-col :span="4" align="right">
    <el-button size="small" v-on:click="btnCancelClick">取 消</el-button>
  </el-col>
</el-row>

@section Scripts{
<script src="/sitefiles/assets/js/admin/wx/layerImage.js" type="text/javascript"></script> }